<%--供号商登录后,查看sp的页面,每个sp对应的要能看到流水--%>
<%@ taglib prefix="page" uri="http://com.qipay/pagelib" %>
<%@ page language="java" import="com.qipay.admin.utils.SiteHelper" contentType="text/html;charset=utf-8" %>
<%@ page import="com.qipay.baas.model.Sp" %>
<%@ page import="com.qipay.core.entity.Pagination" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="java.util.List" %>
<!doctype html>
<html>
<head>
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <jsp:include page="head.jsp"></jsp:include>
    <link rel="stylesheet" href="<%= request.getAttribute("StaticHost") %>/css/dataTables.bootstrap.min.css">
    <link rel="stylesheet" href="<%= request.getAttribute("StaticHost") %>/css/list.css">
    <style>
        #loading{
            width:100%;
            height:100%;
            border:3px solid #C3DAF9;
            position:absolute;
            top:0px;
            left:0px;
            z-index:10000;
            background-color:#F7F9FC;
            line-height:900px;
            text-align: center;
            vertical-align:middle;
            font-size:11pt;
            display:none;
            opacity: 0.4;
        }
    </style>
    <script type="text/javascript">
        //document.getElementsByTagName("html")[0].style.width=screen.availWidth/100+"px";
        document.getElementsByTagName("html")[0].style.fontSize = screen.availWidth / 200 + "px";
    </script>
    <style type="text/css">
        .border {
            border: 1px solid red;
        }
    </style>
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
    <jsp:include page="nav.jsp"></jsp:include>
    <jsp:include page="left.jsp"></jsp:include>
    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Main content -->
        <section class="content">
            <div class="row">
                <div class="col-md-12">
                    <div class="box">
                        <div class="box-header">
                            <h3 class="box-title">支付宝通道列表</h3>
                            <%--<a href="${pageContext.request.contextPath}/sp/add">
                                <button type="button" class="button back-gray" style="font-size: 1rem">添加SP</button></a>--%>
                        </div>

                        <!-- /.box-header -->
                        <div class="tableContent">
                            <table width="100%" cellspacing="0" cellpadding="0" border="1">
                                <thead>
                                <tr>
                                    <th width="3%">ID</th>
                                    <th width="5%">SP名称</th>
                                    <%--<th width="8%">商户ID</th>--%>
                                    <th width="10%">服务</th>
                                    <th width="10%">渠道</th>
                                    <th width="5%">供号商</th>
                                    <th width="10%">银行卡号</th>
                                    <th width="10%">加入时间</th>
                                    <th width="3%">状态</th>
                                    <th width="10%">通道状态</th>
                                    <th width="10%">操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                <% List<Sp> articles = (List<Sp>) request.getAttribute("spList");
                                    Pagination pagination = (Pagination) request.getAttribute("pagination");
//                                    String query = pageContext.getRequest().getServletContext().getContextPath() + "/sp" + pager.getUrl();
//                                    query = StringUtils.replace(query, "s=null", "s=");
                                    if (articles != null && articles.size() > 0) {
                                        Iterator<Sp> iter = articles.iterator();
                                        Sp user = null;
                                        while (iter.hasNext()) {
                                            user = iter.next();

                                %>
                                <tr id="user_<%=user.getId()%>">
                                    <td><%=user.getId()%>
                                    </td>
                                    <td><%=user.getName()%>
                                    </td>
                                    <%--<td><%=user.getMchId()%>--%>
                                    </td>
                                    <td>
                                        <%= user.getService()%>
                                    </td>
                                    <td>
                                        <%--<a href="${pageContext.request.contextPath}/sp?bank=<%= user.getBank()%>"
                                           style="color: #778899">--%>
                                        <%= user.getBank()%>
                                        </a><%----%>
                                    </td>
                                    <td>
                                        <%= user.getSpUserName()%>
                                    </td>
                                    <td>
                                        <%= user.getCardNo()%>
                                    </td>
                                    <td>
                                        <%= SiteHelper.getDefaultTimeFormat(user.getCreateDate())%>
                                    </td>
                                    <td id="trgoods<%= user.getId()%>"
                                        class="<%= user.getState()!=null&&user.getState()==0?"success":""%>"><%= SiteHelper.getChannelStateString(user.getState())%>
                                    </td>
                                    <td>
                                        <%if (user.getFailReason() == null) {%>
                                        <span style="color: #00e765">正常</span>
                                        <%} else {%>
                                        <span style="color: red"><%= user.getFailReason()%></span>
                                        <%}%>
                                    </td>
                                    <td>
                                        <%-- 供号商只能查看流水--%>
                                        <button type="button"
                                                class="button back-gray"
                                                onclick="lookSpuserOrderList(<%=user.getId()%>,true)"
                                                data-toggle="modal"
                                                data-target="#spuser_orderlist"
                                                style="font-size: 1rem">
                                            查看流水
                                        </button>
                                    </td>
                                </tr>
                                <%
                                    }
                                } else {
                                %>
                                <tr>
                                    <td colspan="5">no data.</td>
                                </tr>
                                <% }%>
                                </tbody>
                            </table>
                            <div class="col-sm-10">
                                <div class="dataTables_paginate paging_simple_numbers" id="example1_paginate">
                                    <page:page totalSum="<%= pagination.getTotal()%>"
                                               url="/spUser/spListQuery"
                                               pageNo="<%= pagination.getPage()%>"
                                               pageSize="<%= pagination.getPageSize()%>"></page:page>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
    </div>
    <div id="loading" style="display:none">
        <img src="<%= request.getAttribute("StaticHost") %>/img/loading.gif"  alt="" />正在处理数据,请稍候...</div>
    <jsp:include page="spuser_orderlist.jsp"/>

    <!-- /.content-wrapper -->
    <jsp:include page="foot.jsp"></jsp:include>
</div>
<script src="<%= request.getAttribute("StaticHost") %>/js/jquery.slimscroll.min.js"></script>
<script src="<%= request.getAttribute("StaticHost") %>/js/fastclick.js"></script>
<script src="<%= request.getAttribute("StaticHost") %>/js/adminlte.min.js"></script>
<script>
    $(function () {
        //查看支付宝账号流水
        $("[name='queryOrder']").click(function () {
            var pk = $(this).attr("pk");
            if (pk > 0) {
                if (confirm("确定删除吗？")) {
                    $.ajax({
                        url: "${pageContext.request.contextPath}/ajax?n=setspdeleteflag&id=" + pk,
                        type: "GET",
                        async: true,//true异步 false同步
                        context: this,
                        timeout: 10000,
                        success: function (data) {
                            if (data != null && data == "1") {
                                $("#user_" + pk).hide(100);
                            }
                            else {
                                alert("fail:" + data);
                            }
                        },
                        error: function (d, s, b) {
                            alert("失败:" + b);
                        }
                    });
                }
            }

        });
    });
</script>
</body>
</html>

